<template>
	<view style="display: flex;flex-direction: column;align-items: center;">
		<u-navbar title="个人介绍" @rightClick="onSave"
			:leftIconSize="'40rpx'"
			:fixed="false"
			:autoBack="true"
			style="width: 100%;"
			>
			<view class="saveWrapper" slot="right">
				保存
			</view>
		</u-navbar>
		
		<textarea class="personSignature" v-model="personSignature" 
			placeholder="请输入个人介绍" />

	</view>

</template>

<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex';
	let that = null
	const api = require("@/static/js/api.js")
	const utils = require("@/static/js/utils.js")

	export default {
		computed: {
			...mapState({
				hasLogin: state => state.userInfo.hasLogin,
				isAuthPhone: state => state.userInfo.isAuthPhone,
				isAuthUserInfo: state => state.userInfo.isAuthUserInfo,
				isSeller: state => state.userInfo.isSeller,
				sellerObj: state => state.userInfo.sellerObj,
				buyerObj: state => state.userInfo.buyerObj,
				shopInfo: state => state.userInfo.shopInfo,
				buyerId: state => state.userInfo.buyerObj.id,
			}),
		},
		data() {
			return {
				personSignature: "",
				personSignatureFocus: true,
			};
		},
		onLoad(options) {
			that = this;
			that.personSignature = that.sellerObj.personSignature || ''
		},

		components: {

		},

		methods: {
			...mapMutations(['setUserInfo', 'setLoginStatus', 'setUserId', "setShopInfo"]),


			onSave(){
				api.updateSalesmanCard({
					param: {
						personSignature:  that.personSignature,
					}
				}).then(res => {
					console.log("uploadAvatar:", res)
					if (res.success){
						uni.showToast({
							title:'保存成功!'
						})
						api.getUserInfo().then(res1 => {
							if (res1.success) {
								that.setUserInfo(res1.data)
								uni.navigateBack()
							} else {
						
							}
						}).catch(err => {
						
						})
					}
				})
			},
		}
	}
</script>
<style>
	page {
		background-color: #F3F3F3;
	}
</style>
<style lang="scss">
	.saveWrapper{
		height: 55rpx;
		background-color: #17f;
		color: #fff;
		border-radius: 10rpx;
		text-align: center;
		padding: 0 20rpx;
		line-height: 55rpx;
		font-size: 26rpx;
	}
	


	.personSignature {
		box-sizing: border-box;
		min-height: 246rpx;
		width: 702rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		padding: 45rpx 31rpx;
		margin-top: 20rpx;
	}

	.personSignatureEdit {
		border: solid 1rpx #32b0ff;
	}





</style>